<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<title>设备详情</title>

    <script type="text/javascript">
        var APPVERSION = Date.now();
        document.write('<link rel="stylesheet" href=\"\/aigo\/css\/reset.css?v='+APPVERSION+'\">');
        document.write('<link rel="stylesheet" href=\"\/aigo\/css\/devicedetail.css?v='+APPVERSION+'\">');
    </script>
</head>
<body>
<div class="main-view">
<form id = "form1">	
	<div class="device_body">
		<div class="devictype">
			<span>我的设备</span>
		</div>
		<section class="list">
		<ul class="list-ul">
			<li class="itemWipe">
				<div class="con"><input type="text" value="${(dname.udname)!}" placeholder="请输入您的设备名称" id="devicename" name="devicename"/></div>
				<div class="edit"><div>
			</li>		
		</ul>
		</section>
	</div>
	<div class="device_body otherdevice">
		<div class="values">
			<span>自定义阀值</span>
		</div>
		<section class="list">
		<ul class="list-ul">
			<li class="itemWipes">
				<div class="left">安全范围：</div>
				<div class="right">
					<div class="lists">
					  <label>可燃气体</label>
					  <input class="kr jh" type="number" value="${(deviceset.krlow)!}" id="krlow" name="krlow"/>-<input class="kr" type="number" value="${(deviceset.krlowd)!}" id="krlowd" name="krlowd"/>%LEL
					</div>
					<div class="lists">
					  <label>有毒气体</label>
					  <input class="yd jh" type="number" value="${(deviceset.ydlow)!}"  id="ydlow" name="ydlow""/>-<input class="yd" type="number" value="${(deviceset.ydlowd)!}"  id="ydlowd" name="ydlowd"/>PPM
					</div>					
				</div>
			</li>
			<li class="itemWipes">
				<div class="left">泄露报警:</div>
				<div class="right">
					<div class="lists">
					  <label>可燃气体</label>
					  <input class="kr jh" type="number" value="${(deviceset.krlows)!}"  id="krlows" name="krlows"/>-<input class="kr" type="number" value="${(deviceset.krlowsd)!}"  id="krlowsd" name="krlowsd"/>%LEL
					</div>
					<div class="lists">
					  <label>有毒气体</label>
					  <input class="yd jh" type="number" value="${(deviceset.ydlows)!}"  id="ydlows" name="ydlows"/>-<input class="yd" type="number" value="${(deviceset.ydlowsd)!}"  id="ydlowsd" name="ydlowsd"/>PPM
					</div>					
				</div>
			</li>
			<li class="itemWipes">
				<div class="left">消防报警:</div>
				<div class="right">
					<div class="lists">
					  <label>可燃气体</label>
					  <input class="kr jh" type="number" value="${(deviceset.krlowss)!}"  id="krlowss" name="krlowss"/>-<input class="kr" type="number" value="${(deviceset.krlowssd)!}"  id="krlowssd" name="krlowssd"/>%LEL
					</div>
					<div class="lists">
					  <label>有毒气体</label>
					  <input class="yd jh" type="number" value="${(deviceset.ydlowss)!}"  id="ydlowss" name="ydlowss"/>-<input class="yd" type="number" value="${(deviceset.ydlowssd)!}"  id="ydlowssd" name="ydlowssd"/>PPM
					</div>					
				</div>
			</li>		
		</ul>
		</section>
	</div>
	<div class="btn" id="sub"><button type="submit" class="btn" id="submits">确定</button></div>
	</form>
	<div class="editshow">
		<div class="tols"></div>
		<div class="box">
			<div class="inputbox">
				<label>设置为内容范围内的数值哦</label>
			</div>
			<div class="btn"><span id="ok">知道了</span></btn>
		</div>
	</div>
</div>
<script>
	document.write('<script src=\"\/aigo\/js\/jqury.js?v=' + APPVERSION + '\"><\/script>')
	document.write('<script src=\"\/aigo\/js\/fastclick.js?v=' + APPVERSION + '\"><\/script>')
</script>
<script type="text/javascript">
$( document ).ready(function() {
	$("#submits").on('click',function(){
		$.ajax({
            type: "POST",
            url: "/wx/sava/${(dname.id)!}",
            data: $('#form1').serialize(),
            success: function(res) { 
                if (res.msg == 'success') {
                	location.reload(); 
                	alert("保存成功");
                } else {
                	alert(res.msg);
                }
            }
        });
	});
	$(".kr").blur(function(){
		var thisval = $(this).val();
		var thisid = $(this).attr("id");
		var dd = [];
		var dd = thisid.split("d");
		var statrval = $("#"+dd[0]).val();
		if(parseInt(statrval)>=parseInt(thisval)){
			showbox("不能小于开始值");
			$(this).focus();
		}
		if(thisid=="krlowd"){
			var dd = parseInt(thisval)+1;
			$("#krlows").val(dd);
		}
		if(thisid=="krlowsd"){
			var dd = parseInt(thisval)+1;
			$("#krlowss").val(dd);
		}
		if(thisval>100){
			showbox("设置为范围内的值哦（0-100）");
			$(this).focus();
		}
	});
	$(".yd").blur(function(){
		var thisval = $(this).val();
		var thisid = $(this).attr("id");
		var dd = [];
		var dd = thisid.split("d");
		var statrval = $("#"+dd[0]).val();
		if(parseInt(statrval)>=parseInt(thisval)){
			showbox("不能小于开始值");
			$(this).focus();
		}
		if(thisid=="ydlowd"){
			var dd = parseInt(thisval)+1;
			$("#ydlows").val(dd);
		}
		if(thisid=="ydlowsd"){
			var dd = parseInt(thisval)+1;
			$("#ydlowss").val(dd);
		}
		if(thisval>1000){
			showbox("设置为范围内的值（0-1000）");
			$(this).focus();
		}
	});
	$("#ok").on('click',function(){
		hdiebox();
	});
	function hdiebox(){
		$(".editshow").hide();
		$(".box").hide();
	}
	function showbox(text){
		$(".editshow").show();
		$(".inputbox>label").text(text);
		$(".box").show();
	}	
	function showtols(text){
		$(".editshow").show();
		$(".tols").text(text);
		$(".tols").show();
	}	
	function hidetols(){
		alert("sd");
		$(".editshow").hide();
		$(".tols").text(" ");
		$(".tols").hide();
	}	
})
</script>
</body>
</html>